package com.aooci.ordercat.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.aooci.ordercat.dao.SortGroupDAO;
import com.aooci.ordercat.domain.SortGroup;

/**
 * A data access object (DAO) providing persistence and search support for
 * Account entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.bitongline.lgs.dao.Account
 */
public class SortGroupDAOImpl extends AbstractBaseDAOImpl<SortGroup, Integer> implements SortGroupDAO {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6401782102938628727L;

	public SortGroupDAOImpl() {
		super(SortGroup.class);
	}

	private static final Logger log = Logger.getLogger(SortGroupDAOImpl.class);

	@Override
	public List<SortGroup> selectSortGroupBySelectable(final boolean selectable) {
	    return getHibernateTemplate().execute(new HibernateCallback<List<SortGroup>>() {  
	        @SuppressWarnings("unchecked")
			@Override  
	        public List<SortGroup> doInHibernate(Session session)  
	            throws SQLException {  
	        	Query query = session.getNamedQuery("SORT_GROUP.selectSortGroupBySelectable");
	        	query.setParameter("selectable", selectable);
	            return (List<SortGroup>)query.list();  
	        }  
	    });
	}



}